require 'mongrel_cluster/recipes'
set :application, "farnsworth"
set :repository,  "http://farnsworth.googlecode.com/svn/trunk/"
set :user, "ritt0249"
set :password, "h3jvxx"
set :use_sudo, true
set :runner, nil

# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
set :deploy_to, "/var/www/#{application}"
set :mongrel_conf, "#{current_path}/config/mongrel_cluster.yml"

# If you aren't using Subversion to manage your source code, specify
# your SCM below:
# set :scm, :subversion

role :app, "mythbox"
role :web, "mythbox"
role :db,  "mythbox", :primary => true

#task :configure_mongrel do
#  run "cd #{current_path} && mongrel_rails cluster::configure -e production -p 3010 -N 2 -c #{current_path} -a 127.0.0.1 --user mongrel --group mongrel"
#  run "sudo -S chown -R mongrel:mongrel  #{current_path}/tmp | echo '#{sudo_password}'"
#  run "sudo -S chown -R mongrel:mongrel  #{current_path}/log | echo '#{sudo_password}'"
#end

task :setup_mysql, :roles => :db do
  run "cd #{current_path} && rake db:mysql:production root=#{mysql_root_password}"
end

task :restart, :roles => :app do
  run "cd #{current_path} && mongrel_rails cluster::restart -C config/mongrel_cluster.yml"
end

task :engage do
  deploy
  migrate
  enable_web
end

task :warp do
  disable_web
  deploy_with_migrations
  enable_web
end

desc "remove mongrel pid files"
task :clean_mongrel do
  sudo "rm #{shared_path}/log/mongrel.*.pid"
end

